#ifndef LCD_H
#define LCD_H
/*
*前面我们列举了LCD的参数，例如引脚的极性、时序、数据的格式bpp、分辨率等，使用面向对象的思维方式，将这些封装成结构体放在lcd.h
*/
/* LCD 参数有： clk，rgb，hysnc，vsync
1、行、场的时间参数
2、分辨率
3、引脚极性
4、Framebuffer地址-->lcd_controler
*/
enum{
	NORMAL = 0,
	INVERT = 1,
};

//引脚极性
typedef struct {
	int pixel_clk;	//NORMAL
	int rgb;		//NORMAL
	int hsync;		//INVERT
	int vsync;		//INVERT
	int vd_de;		//NORMAL
	int power_en;	//NORMAL???跟以前旧的裸机不一致？
}pins_polarity;

//LCD时序,完全按LCD的命名来写
typedef struct {
	//pixel clk
	int pixel_clk;

	//line
	int thp;	//hsync pulse wide
	int thb;	//time to prepare active data 左边黑框
	int thf;	//after this time hsync pulse occur 右边黑框
	//int hsync;	//没有大小，只有极性

	//frame
	int tvp;	//vsync pulse wide
	int tvb;	//ready to prepare active data after time 上边黑框
	int tvf;	//occur vsync pulse after this time 下边黑框
	//int vsync;	//没有大小，只有极性
}time_sequence;

typedef struct {
	char *name;
	//引脚的极性
	pins_polarity lcd_polarity;	
	//时序
	time_sequence lcd_squence;
	
	//数据的格式bpp、分辨率
	int bpp;
	int xres;
	int yres;
	
	//FB地址	
	unsigned int fb_base;
}lcd_pramas, *p_lcd_params;

typedef struct {
	void(*init)(void);
	char name;	
}lcd_operation;

int register_lcd(p_lcd_params plcd);
int select_lcd(char *name);
void lcd_init(void);
void lcd_enable(void);
void lcd_disable(void);
void lcd_4_3_add(void);
void get_lcd_params(unsigned int *fb_base, unsigned int *bpp, unsigned int *xres, unsigned int *yres);
void lcd_test(void);

#endif

